/* 聊天框整体样式 */
.chat-container {
  position: fixed;
  width: 350px;
  height: 500px;
  background: #fff;
  border: 1px solid #ddd;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.05s ease;
  bottom: 20px;
  right: 20px;
}

/* 聊天头部 */
.chat-header {
  background-color: #3f51b5;
  color: white;
  padding: 12px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: move;
  user-select: none;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* 切换按钮样式 */
.toggle-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  transition: background 0.2s;
}
.toggle-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* 消息区域 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  word-break: break-word;
  white-space: pre-wrap;
  padding: 15px;
  background: #f4f6f9;
  font-size: 15px;
  color: #333;
  max-height: calc(100% - 100px);  /* 留出空间给输入框和头部 */
}

/* 美化滚动条 */
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
  background-color: #ccc;
  border-radius: 4px;
}

/* 输入框区域 */
.chat-input {
  padding: 10px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 6px;
  background: #fafafa;
}

/* 输入框文本样式 */
.chat-input input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  transition: border 0.2s;
}
.chat-input input:focus {
  outline: none;
  border-color: #3f51b5;
}

/* 发送按钮样式 */
.chat-input button {
  background-color: #3f51b5;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.chat-input button:hover {
  background-color: #303f9f;
}

/* 收起聊天框样式 */
.collapsed {
  height: auto !important;
  width: 350px;
}

.collapsed .chat-messages,
.collapsed .chat-input {
  display: none;
}

/* 系统消息样式（蓝灰色） */
.system-message {
  background-color: #e2e3f3;  /* 浅蓝灰 */
  color: #383d75;  /* 深蓝灰色文字 */
  font-style: italic;
  border-left: 4px solid #b6b9f2;
  padding: 12px 18px;
  margin: 10px 0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.4;
}

/* 错误消息样式（红色） */
.error-message {
  background-color: #f8d7da;
  color: #721c24;
  font-style: italic;
  border-left: 4px solid #f5c6cb;
  padding: 12px 18px;
  margin: 10px 0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.4;
}

/* 用户消息样式（绿色） */
.user-message {
  background-color: #d4edda;
  color: #155724;
  font-weight: bold;
  border-left: 4px solid #c3e6cb;
  padding: 12px 18px;
  margin: 10px 0;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  font-size: 14px;
  max-width: 85%;
  word-wrap: break-word;
  line-height: 1.4;
}
